package com.plian.system.wrapper.sys;

import com.plian.system.dto.sys.SystemRecordDTO;
import com.plian.system.entity.sys.SystemRecord;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.sys.SystemRecordVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperConstant;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * 包装类,返回视图层所需的字段
 *
 * @author gangan
 * @since 2019-09-27
 */
@Mapper(componentModel = WrapperConstant.SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface SystemRecordWrapper extends BaseWrapper<SystemRecord, SystemRecordDTO, SystemRecordVO> {


	/**
	 * Entity转VO
	 *
	 * @param entity /
	 * @return /
	 */
	@Override
	@Mappings(value = {
			@Mapping(source = "orgId", target = "orgName", qualifiedByName = WrapperConstant.ORG_ID_TO_NAME),
			@Mapping(source = "createUser", target = "createUserName", qualifiedByName = WrapperConstant.USER_ID_TO_NAME),
			@Mapping(source = "departmentCode", target = "departmentName", qualifiedByName = WrapperConstant.DICT_CODE_TO_NAME),
			@Mapping(source = "systemTypeCode", target = "systemTypeName", qualifiedByName = WrapperConstant.DICT_CODE_TO_NAME),
			@Mapping(source = "systemStatus", target = "systemStatusStr", qualifiedByName = WrapperConstant.SYSTEM_STATUS),
	})
	SystemRecordVO entityToVO(SystemRecord entity);
}
